package com.ibiaoke.boss.controller;

import com.ibiaoke.common.base.BaseController;
import com.ibiaoke.common.response.Res;
import com.ibiaoke.customer.entity.Customer;
import com.ibiaoke.marketing.entity.ShareUserRel;
import com.ibiaoke.marketing.service.ShareUserRelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class ShareController extends BaseController{

    @Autowired
    private ShareUserRelService shareUserRelService;

    /**
     * 分享活动
     * @return
     */
    @RequestMapping("share")
    public Res share(){
        Customer customer=getLoginUser();
        return shareUserRelService.share(customer.getCustomerId());
    }

    /**
     * 领取活动优惠券
     * @param shareUserRelId
     * @return
     */
    @RequestMapping("receiveShareCoupon")
    public Res share(Integer shareUserRelId){
        Customer customer=getLoginUser();
        return shareUserRelService.receiveShareCoupon(customer.getCustomerId(), shareUserRelId);
    }
}
